#include <pthread.h>
#define INF 0
#define DBG 1
#define ERR 2
#define FAT 3
#define DEFAULT_LOG_LEVEL INF

#define LOG(LEVEL,format,...) do{\
    if(LEVEL>=DEFAULT_LOG_LEVEL){\
        time_t t=time(NULL);\
        struct tm *lt=localtime(&t);\
        char time_str[64] = {0};\
        strftime(time_str,63,"%Y-%m-%d %H:%M:%S",lt);\
        fprintf(stdout,"[%s][%p][%s:%d] " format "\n",time_str,(void*)pthread_self(),__FILE__,__LINE__,##__VA_ARGS__);\
        }\
    }while(0)


#define LOG_INF(format,...) LOG(INF,format,##__VA_ARGS__)
#define LOG_DBG(format,...) LOG(DBG,format,##__VA_ARGS__)
#define LOG_ERR(format,...) LOG(ERR,format,##__VA_ARGS__)
#define LOG_FAT(format,...) LOG(FAT,format,##__VA_ARGS__)
    